package cn.xrfzh.common.utils;

import java.io.Serializable;
import java.util.List;

public class XrPageUtil implements Serializable {

	private static final long serialVersionUID = 1L;

	// 列表数据
	private List<?> records;

	// 当前页数
	private int current;

	// 每页记录数
	private int size;

	// 总记录数
	private int total;

	// 总页数
	private int pages;

	public static XrPageUtil respByPage(List<?> records, int current, int size, int total) {
		return new XrPageUtil(records, current, size, total, (int) Math.ceil((double) total / size));
	}

	public XrPageUtil(List<?> records, int current, int size, int total, int pages) {
		this.records = records;
		this.current = current;
		this.size = size;
		this.total = total;
		this.pages = pages;
	}

	public List<?> getRecords() {
		return records;
	}

	public void setRecords(List<?> records) {
		this.records = records;
	}

	public int getCurrent() {
		return current;
	}

	public void setCurrent(int current) {
		this.current = current;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getPages() {
		return pages;
	}

	public void setPages(int pages) {
		this.pages = pages;
	}

}
